package com.qst.rongxiaoserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qst.rongxiaoserver.mapper.ExpertMapper;
import com.qst.rongxiaoserver.model.ExpertModel;
import com.qst.rongxiaoserver.service.IExpertService;
import org.springframework.stereotype.Service;

// 实现类
@Service
public class ExpertServiceImpl extends ServiceImpl<ExpertMapper, ExpertModel> implements IExpertService {

    @Override
    // 分页查询专家列表
    public Page<ExpertModel> listExpert(int pageNum, int pageSize,  String expertName) {
        Page<ExpertModel> pageObj = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<ExpertModel> queryWrapper = new LambdaQueryWrapper<>();
        // 条件查询
        if (expertName != null && !expertName.isEmpty()) {
            queryWrapper.like(ExpertModel::getRealName, expertName);
        }
        return this.page(pageObj, queryWrapper);
    }
}
